﻿#ifndef XUNFEI_IAT_H
#define XUNFEI_IAT_H

#include <QObject>
#include "WebSocketClient.h"
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QFile>
#include <QThread>
#include <QTimer>

class Xunfei_iat : public QObject
{
    Q_OBJECT
public:
    explicit Xunfei_iat(QObject *parent = nullptr);

public slots:
    void sendAudio();   //发送音频数据
    void parseTextMsg(const QString& content);  //解析返回数据
    void parseBinaryMsg(const QByteArray& data);  //解析返回数据
    void ws_error(const QString& content);  //websocket客户端发生错误
signals:
    void msg_to_ui(const QString& content);
private:
    QTimer* timer;

    WSClient* wsClient = nullptr;
    QFile audiofile;
    QString app_id = "";
//    QString app_id = "6043020e";
    QJsonObject commonArgs;
    QJsonObject BusinessArgs;
};

#endif // XUNFEI_IAT_H
